package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduStudentEnroll.*;
import com.jwsoft.manager.common.vo.eduStudentEnrollVerification.EduStudentEnrollVerificationVO;
import com.jwsoft.manager.core.integration.EduStudentEnrollImitateIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 模拟报名网关
 *
 * @author chenzh
 * @since 2024-03-11
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "模拟报名", description = "模拟报名")
public class EduStudentEnrollImitateController {

    @Autowired
    public EduStudentEnrollImitateIntegration eduStudentEnrollImitateIntegration;

    @Operation(summary = "模拟报名分页查询",description = "模拟报名分页查询")
    @PostMapping(value = "/enrollImitate0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduStudentEnrollVO>> getList(@RequestBody @Validated EduStudentEnrollQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.getList(vo));
    }

    @Operation(summary = "模拟报名根据主键查询详情",description = "模拟报名根据主键查询详情")
    @PostMapping(value = "/enrollImitate0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollVO> getById(@RequestBody @Validated EduStudentEnrollKeyVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.getById(vo));
    }

    @Operation(summary = "获取义务教育模拟报名单个明细",description = "获取义务教育模拟报名单个明细")
    @PostMapping(value = "/enrollImitate0013", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollVO> getYwApplyDetail(@RequestBody @Validated EduStudentEnrollKeyVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.getYwApplyDetail(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "模拟报名新增",description = "模拟报名新增")
    @PostMapping(value = "/enrollImitate0004", produces = "application/json;charset=UTF-8")
    public AppResponse<SaveStudentEnrollVO> add(@RequestBody @Validated(value = {Validators.Add.class}) SaveStudentEnrollVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.add(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "模拟报名家长端报名",description = "模拟报名家长端报名")
    @PostMapping(value = "/enrollImitate0019", produces = "application/json;charset=UTF-8")
    public AppResponse<SaveStudentEnrollVO> saveEnrollApp(@RequestBody @Validated(value = {Validators.Add.class}) SaveStudentEnrollVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.saveEnrollApp(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "模拟报名修改",description = "模拟报名修改")
    @PostMapping(value = "/enrollImitate0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduStudentEnrollVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "模拟报名删除",description = "模拟报名删除")
    @PostMapping(value = "/enrollImitate0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduStudentEnrollKeyVO vo) {
        eduStudentEnrollImitateIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育报名一键退回到待审核",description = "义务教育报名一键退回到待审核")
    @PostMapping(value = "/enrollImitate0014", produces = "application/json;charset=UTF-8")
    public AppResponse ywApplyBackAuth(@RequestBody @Validated(value = {Validators.Edit.class}) EduStudentEnrollKeyVO vo) {
        eduStudentEnrollImitateIntegration.backAuth(vo);
        return AppResponse.success();
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育报名退回",description = "义务教育报名退回")
    @PostMapping(value = "/enrollImitate0015", produces = "application/json;charset=UTF-8")
    public AppResponse ywApplyBack(@RequestBody @Validated(value = {Validators.Edit.class}) EduStudentEnrollKeyVO vo) {
        eduStudentEnrollImitateIntegration.ywApplyBack(vo);
        return AppResponse.success();
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "家长端义务教育模拟报名撤销",description = "家长端义务教育模拟报名撤销")
    @PostMapping(value = "/enrollImitate0063", produces = "application/json;charset=UTF-8")
    public AppResponse ywApplyBackApp(@RequestBody @Validated(value = {Validators.Edit.class}) EduStudentEnrollKeyVO vo) {
        eduStudentEnrollImitateIntegration.ywApplyBackApp(vo);
        return AppResponse.success();
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育报名修改报名状态",description = "义务教育报名修改报名状态")
    @PostMapping(value = "/enrollImitate0016", produces = "application/json;charset=UTF-8")
    public AppResponse updateEnrollStatus(@RequestBody @Validated(value = {Validators.Edit.class}) UpdateEnrollStatusVO vo) {
        eduStudentEnrollImitateIntegration.updateEnrollStatus(vo);
        return AppResponse.success();
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育模拟报名审核",description = "义务教育模拟报名审核")
    @PostMapping(value = "/enrollImitate0043", produces = "application/json;charset=UTF-8")
    public AppResponse ywAudit(@RequestBody  StudentEnrollSaveVO vo) {
        eduStudentEnrollImitateIntegration.ywAudit(vo);
        return AppResponse.success();
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育教育局模拟复审",description = "义务教育教育局模拟复审")
    @PostMapping(value = "/enrollImitate0037", produces = "application/json;charset=UTF-8")
    public AppResponse ywReview(@RequestBody @Validated StudentEnrollSaveVO vo) {
        eduStudentEnrollImitateIntegration.ywReview(vo);
        return AppResponse.successMsg("操作成功！");
    }
    @Operation(summary = "模拟报名线下核验材料查询",description = "模拟报名线下核验材料查询")
    @PostMapping(value = "/enrollImitate00044", produces = "application/json;charset=UTF-8")
    public AppResponse<List<EduStudentEnrollVerificationVO>> getVerification(@RequestBody  EduStudentEnrollVerificationVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.getVerification(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "模拟报名线下核验材料核验",description = "模拟报名线下核验材料核验")
    @PostMapping(value = "/enrollImitate00045", produces = "application/json;charset=UTF-8")
    public AppResponse verificationAudit(@RequestBody  EduStudentEnrollVerificationVO vo) {
        eduStudentEnrollImitateIntegration.verificationAudit(vo);
        return AppResponse.success();
    }
    @Operation(summary = "义务教育模拟报名人数信息查询",description = "义务教育模拟报名人数信息查询")
    @PostMapping(value = "/enrollImitate0020", produces = "application/json;charset=UTF-8")
    public AppResponse<StudentEnrollCntVO> queryBmCnt(@RequestBody @Validated EduStudentEnrollQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollImitateIntegration.queryBmCnt(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育公办模拟报名信息导出",description = "义务教育公办模拟报名信息导出")
    @PostMapping(value = "/enrollImitate0021", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public void exportYwGbApplyInfo(@RequestBody @Validated EduStudentEnrollQueryVO vo, HttpServletResponse response) {
        eduStudentEnrollImitateIntegration.exportYwGbApplyInfo(vo,response);
    }
}
